package cn.maxhou.demo.web;

import cn.maxhou.demo.comm.KtjiaoyuInfo;
import cn.maxhou.demo.service.DemoService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @Resource
    private KtjiaoyuInfo ktjiaoyuInfo;

    @Autowired
    private DemoService demoService;

    @Value("${cn.maxhou.name}")
    private String name;
    @Value("${cn.maxhou.email}")
    private String email;

    @RequestMapping("/hello")
    public String hello(){
        String msg=demoService.sayHello();
        msg +=" "+name +" "+email;
        return msg;
    }

    @RequestMapping("/hello2")
    public String hello2(){
        String msg=demoService.sayHello();
        msg +=" "+ktjiaoyuInfo.getName() +" "+ktjiaoyuInfo.getEmail();
        return msg;
    }
}
